package com.asohofrucol.web;

import javax.faces.event.ActionEvent;

import org.primefaces.context.RequestContext;
import org.springframework.beans.factory.annotation.Autowired;

import com.asohofrucol.dto.AsohofrucolSessionDTO;
import com.asohofrucol.dto.AssistenceRegisterDTO;
import com.asohofrucol.service.TechnicalAssistanceService;

public class AssistanceController {
	@Autowired
	private AsohofrucolSessionDTO aSession;
	@Autowired
	private TechnicalAssistanceService technicalAssistanceService;
	public void viewOwnerData(ActionEvent actionEvent) {
		System.out.println("OwnerData");
		RequestContext context = RequestContext.getCurrentInstance();
		context.addCallbackParam("view", "owner_data.xhtml");
	}

	public void viewCropClassification(ActionEvent actionEvent) {
		System.out.println("viewPersonalData");
		RequestContext context = RequestContext.getCurrentInstance();
		context.addCallbackParam("view", "crop_classification.xhtml");
	}

	public void viewAssistance(ActionEvent actionEvent) {
		System.out.println("viewAssistance");
		RequestContext context = RequestContext.getCurrentInstance();
		context.addCallbackParam("view", "assistance.xhtml");
	}
	
	public void testLoadAssistance(ActionEvent actionEvent){
		AssistenceRegisterDTO assistenceRegisterDTO = new AssistenceRegisterDTO();
		assistenceRegisterDTO.setVisitDataDTO(technicalAssistanceService.getTechniclaAssitanceVistData(1L));
		aSession.setSelectedAssistenceRegister(assistenceRegisterDTO);
	}
}
